<?php
/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Copyright 2014 The moOde audio player project / Tim Curtis
 * Copyright 2016 Richard Parslow
*/

/*
 * keyboard.php 2016 Richard Parslow
*/

function buildKeyboardSelect($selected) {
    $keyboardList = array(
        "us",
        "gb",
        "af",
        "ara",
        "al",
        "am",
        "at",
        "az",
        "ba",
        "bd",
        "be",
        "bg",
        "br",
        "brai",
        "bt",
        "bw",
        "by",
        "cm",
        "ca",
        "cd",
        "ch",
        "cn",
        "cz",
        "dk",
        "ee",
        "epo",
        "hr",
        "in",
        "ir",
        "iq",
        "fo",
        "fi",
        "fr",
        "gh",
        "gn",
        "ge",
        "de",
        "es",
        "et",
        "gr",
        "hu",
        "ie",
        "is",
        "il",
        "it",
        "jp",
        "ke",
        "kg",
        "kh",
        "kr",
        "kz",
        "la",
        "latam",
        "lk",
        "lt",
        "lv",
        "ma",
        "mao",
        "md",
        "me",
        "mk",
        "ml",
        "mm",
        "mn",
        "mt",
        "mv",
        "ng",
        "no",
        "nl",
        "np",
        "pk",
        "ph",
        "pl",
        "pt",
        "ro",
        "ru",
        "rs",
        "si",
        "sk",
        "se",
        "sn",
        "sy",
        "tj",
        "th",
        "tm",
        "tr",
        "tw",
        "tz",
        "ua",
        "uz",
        "vn",
        "za"
    );

    $data = '';
    foreach ($keyboardList as $kb) {
        $sel = ($selected == $kb) ? ' selected' : '';
        $data .= sprintf("<option value='%s'%s>%s</option>\n", $kb, $sel, $kb);
    }

    return $data;
}

function buildKvariantSelect($selected) {
    $kvariantList = array(
        "Afghani",
        "Amharic",
        "Arabic",
        "Arabic (Morocco)",
        "Arabic (Syria)",
        "Albanian",
        "Armenian",
        "Azerbaijani",
        "Bambara",
        "Belarusian",
        "Belgian",
        "Bangla",
        "Bosnian",
        "Braille",
        "Bulgarian",
        "Burmese",
        "Chinese",
        "Croatian",
        "Czech",
        "Danish",
        "Dhivehi",
        "Dutch",
        "Dzongkha",
        "English (Cameroon)",
        "English (Ghana)",
        "French (Guinea)",
        "English (Nigeria)",
        "English (South Africa)",
        "English (UK)",
        "English (US)",
        "Esperanto",
        "Estonian",
        "Faroese",
        "Finnish",
        "Filipino",
        "French",
        "French (Canada)",
        "French (Democratic Republic of the Congo)",
        "Georgian",
        "German",
        "German (Austria)",
        "German (Switzerland)",
        "Greek",
        "Hebrew",
        "Hungarian",
        "Icelandic",
        "Indian",
        "Iraqi",
        "Irish",
        "Italian",
        "Japanese",
        "Kazakh",
        "Khmer (Cambodia)",
        "Korean",
        "Kyrgyz",
        "Lao",
        "Lithuanian",
        "Latvian",
        "Maori",
        "Montenegrin",
        "Macedonian",
        "Maltese",
        "Moldavian",
        "Mongolian",
        "Nepali",
        "Norwegian",
        "Persian",
        "Polish",
        "Portuguese",
        "Portuguese (Brazil)",
        "Romanian",
        "Russian",
        "Serbian",
        "Slovenian",
        "Slovak",
        "Spanish",
        "Spanish (Latin American)",
        "Swahili (Tanzania)",
        "Swahili (Kenya)",
        "Swedish",
        "Sinhala (phonetic)",
        "Tajik",
        "Thai",
        "Turkish",
        "Taiwanese",
        "Tswana",
        "Turkmen",
        "Ukrainian",
        "Uzbek",
        "Urdu (Pakistan)",
        "Vietnamese",
        "Wolof"
    );

    $data = '';
    foreach ($kvariantList as $kv) {
        $sel = ($selected == $kv) ? ' selected' : '';
        $data .= sprintf("<option value='%s'%s>%s</option>\n", $kv, $sel, $kv);
    }

    return $data;
}
